<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增货位设置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-cellInfo-add">

			<div class="form-group">	
				<label class="col-sm-3 control-label">货物编码：</label>
				<div class="col-sm-8">
					<input id="cellCode" name="cellCode" class="form-control" type="text">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">货架：</label>
				<div class="col-sm-8">
					<select id="shelfId" name="shelfId" class="form-control"  >
						<option v-for="(shelf,index) in shelfs" v-bind:value="shelf.shelfId" v-on:click="getRowAndColumn(index)">{{shelf.shelfName}}</option>
					</select>
				</div>
			</div>


			<div class="form-group">	
				<label class="col-sm-3 control-label">行：</label>
				<div class="col-sm-8">
					<input id="sRow" name="sRow" class="form-control" type="text" :value="row">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">列：</label>
				<div class="col-sm-8">
					<input id="sColumn" name="sColumn" class="form-control" type="text" :value="column">
				</div>
			</div>
<!--			<div class="form-group">	-->
<!--				<label class="col-sm-3 control-label">0-无货；1-有货；2-锁定；3-故障：</label>-->
<!--				<div class="col-sm-8">-->
<!--					<input id="state" name="state" class="form-control" type="text">-->
<!--				</div>-->
<!--			</div>-->


			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
					<div class="col-sm-8">
						<select class="form-control" id="state" name="state">
							<option value="0">无货</option>
							<option value="1">有货</option>
							<option value="2">锁定</option>
							<option value="3">故障</option>

						</select>
					</div>
			</div>




			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="memo" name="memo" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/cellInfo"

		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-cellInfo-add').serialize());
	        }
	    }



		var app = new Vue({
			el: '.wrapper',
			data: {
				message: 'Hello Vue!',
				shelfs:[],
				row : '',
				column : ''
			},

			methods:{

				getRowAndColumn:function(index){
					alert("111");
					var that = this;
					that.row = that.shelfs[index].shelfRow;
					that.column = that.shelfs[index].shelfColumn;

				},




				getShelfs:function(){

					var that = this;
					$.ajax({
						cache : true,
						type : "POST",
						url :  "/system/shelfInfo/list",
						data : {

						},
						async : false,
						error : function(request) {
							$.modal.alertError("系统错误");
						},
						success : function(data) {

							that.shelfs = data.rows;
						}
					});

				}
			},
			created:function(){
				this.getShelfs();

				$("#form-cellInfo-add").validate({
					rules:{
						xxxx:{
							required:true,
						},
					},
					focusCleanup: true
				});
			},
			mounted: function(){
			}

		})


	</script>
</body>
</html>































